/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.vraptor.jpessoal.DAO;

import br.com.caelum.vraptor.ioc.Component;
import br.com.vraptor.jpessoal.bean.Grau;
import br.com.vraptor.jpessoal.util.HibernateUtil;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;

/**
 *
 * @author rodrigogois
 */
@Component
public class GrauDAO {
    
    public List<Grau> listar(){
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        Query query = session.createQuery("from Grau");
        List<Grau> lista = query.list();
        session.getTransaction().commit();
                
        return lista;        
        
        
    }
    
}
